home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 04 / v_getc.c < prev    next >
C/C++ Source or Header  |  1991-05-03  |  659b  |  30 lines

  1. /*    v_getc.c- Get Character from Viewport */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6. #include <tools/viewport.h>
  7.  
  8. int  v_getc( viewport *v )
  9. {
  10.     /* Return the character at the current cursor position in the
  11.      * indicated window, which is activated if necessary. Cursor
  12.      * position doesn't change.
  13.      */
  14.  
  15.     int c;
  16.     int col, row;
  17.  
  18.     if( v->magic != VMAGIC )
  19.         return 0;
  20.  
  21.     if( v->inactive )
  22.         v_open( v );
  23.  
  24.     col  = v->col + v->cur_col + 1;
  25.     row  = v->row + v->cur_row + 1;
  26.     gettext( col, row, col, row, &c );
  27.  
  28.     return c & 0xff ;   /* strip attribute when returning */
  29. }
  30.